Selected ANSI (VT100) ESCape codes
----------------------------------
by Rob Elliott
   Illini Data Fido 115/100

These are ESCape codes that will be of most use to people designing VT100
graphics displays.  Not all of the codes are listed, just the most useful
ones.  


What it does                                             The code
------------                              ESC = 27d      --------
Cursor up Pn lines                            `--------> ESC[PnA
Cursor down Pn lines                                     ESC[PnB
Cursor forward (right) Pn lines                          ESC[PnC
Cursor backward (left) Pn lines                          ESC[PnD
Cursor sent to line Pl and column Pc                     ESC[Pl;PcH or 
                                                         ESC[Pl;Pcf
Cursor position saved                                    ESC7
Cursor position restored                                 ESC8

Change current line to double-height Top half            ESC#3
Change current line to double-height Bottom half         ESC#4
Change current line to normal size                       ESC#5
Change current line to double-width                      ESC#6

Character Attributes                             ESC[Ps;Ps;Ps;...Psm

                  Ps =  0 or none    All attributes off
                        1            Bold on
                        2            Underscore on
                        5            Blink on
                        7            Reverse video on

Erase from cursor to end of line                         ESC[K
Erase from cursor to end of screen                       ESC[J
Erase from beginning of line to cursor                   ESC[1K
Erase from beginning of screen to cursor                 ESC[1J
Erase entire line containing cursor                      ESC[2K
Erase entire screen                                      ESC[2J

United Kingdom Character Set                             ESC(A 
United States (ASCII) Character Set                      ESC(B
Special graphics set (line drawing set)                  ESC(0

Set scrolling from top Pt to bottom Pb                   ESC[Pt;Pb
Set VT52 mode                                            ESC[?2l
Set 132 column mode                                      ESC[?3h
Set 80 column mode                                       ESC[?3l
Set smooth scroll                                        ESC[?4h
Set jump scroll                                          ESC[?4l
Set reverse screen (light background)                    ESC[?5h
Set normal screen (dark background)                      ESC[?5l


Line Drawing Character Set
--------------------------
When the line drawing set is entered, via ESC(0, 

-This-               -will show-
  \                 Diamond
  a                 Checkerboard
  e                 Degree sign
  g                 Plus/minus sign
  j                 Lower-right box corner
  k                 Upper-right box corner
  l                 Upper-left box corner
  m                 Lower-left box corner
  n                 Intersecting lines
  o                 Horizontal line - Scan 1 (bottommost)
  p                 Horizontal line - Scan 3
  q                 Horizontal line - Scan 5 (use this to match box corners)
  r                 Horizontal line - Scan 7
  s                 Horizontal line - Scan 9 (topmost)
  t                 Left "T"
  u                 Right "T"
  v                 Top "T" (looks normal)
  w                 Bottom "T" (upside down)
  x                 Vertical bar
  y                 Less than or equal to sign
  z                 Greater than or equal to sign
  |                 Not equal to
  (                 Pi sign
  )                 UK pound sign
  ~                 Centered dot

        Window:        Line Sloping up:       A normal box:
         lqwql                                        
         x x x                                 lqqqqqqqqk
         tqnqu              opqrs              x        x
         x x x                                 mqqqqqqqqj
         mqvqj


Notes
-----
I highly recommend including the following sequence at the beginning of each
ANSI file:

               ESC[?2lESC<  

This makes the computer jump in and out of VT52 mode.  This resets all the
character sets to G0 designator (especially important) and everything else.
Using this will make sure the character sets show up only when they are
supposed to (no graphics characters when it's a text screen and vice versa).


On IBMs
-------
There are several ways to view these on an IBM PC.  To have ANSI codes work
locally (just TYPE the files and the displays appear) you can do several
things.

1.  Assign ANSI.SYS (free with PC-DOS) as a device driver.  Do this by putting
    this line in CONFIG.SYS:
 
        DEVICE=ANSI.SYS

2.  Download Fansi-Console (FCONSOLE) from any BBS that has it available,
    and install that as specified in the instructions.

To view the codes remotely, it's best to get a VT100 emulating terminal
program.  Many commercial programs have this option.  PC-VT, in the public
domain, was written explicitly for this emulation.  CrossTalk XVI, SmartCom II,
and PTel are some commercial programs with this support.


So...
-----
Send any questions or comments to Illini Data Fido 115/110.
If you call direct, make sure you're using a VT100 emulator!

